package Spring;

import org.example.Spring.HelloSpring;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class testUserName {
    @Test
    public void testUserNameShow(){
        //加载Spring-context.xml文件的配置
        ApplicationContext applicationContext = new
                ClassPathXmlApplicationContext("Spring-context.xml");
        //通过容器获取配置中的helloSpring实例
        HelloSpring helloSpring = (HelloSpring) applicationContext.getBean("helloSpring");
        helloSpring.showUserName();
    }
}
